package com.lz.common;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * <pre>
 * @描述：
 * @作者：lizhao
 * @创建时间： 2024/8/21 上午9:06
 * </pre>
 **/
//该注解声名此类同意处理异常
@RestControllerAdvice
public class CommonExceptionHandler {
    //捕获LzException异常
    @ExceptionHandler(LzException.class)
    public Result<String> exception(Exception e) {
        System.out.println("CommonExceptionHandler异常执行" + e.getMessage());
        return new Result<>(500, e.getMessage());
    }
}
